<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工序物料设计单查询</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/bootstraptable/bootstrap-table.css" rel="stylesheet">
</head>
<body>
<div style="color: #0e9aef;margin: 20px;">您正在做的业务是：生产管理--工序物料设计--工序物料设计单查询</div>
<div style="margin-top: 10px;margin-left: 20px;">符合条件的设计单总数：<span id="design_queries_total"></span>例</div>
<div class="container" style="margin-top: 30px;">
    <form class="form-horizontal" id="manufacture_process_search_form">
        <div class="form-group">
            <label for="search_firstKindId" style="padding-right: 0px;" class="control-label col-md-2" >请选择商品I级分类</label>
            <div class="col-md-2">
                <select id="search_firstKindId" name="search_firstKindId" class="form-control">
                    <option value="">--请选择--</option>
                </select>
            </div>
            <label for="search_secondKindId" class="control-label col-md-2" style="padding-right: 0px;">请选择商品II级分类</label>
            <div class="col-md-2">
                <select id="search_secondKindId" name="search_secondKindId" class="form-control">
                    <option value="">--请选择--</option>
                </select>
            </div>
            <label for="search_thirdKindId" class="control-label col-md-2" style="padding-right: 0px;">请选择商品III级分类</label>
            <div class="col-md-2">
                <select id="search_thirdKindId" name="search_thirdKindId" class="form-control">
                    <option value="">--请选择--</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="search_reviewStatus" class="control-label col-md-2" style="padding-right: 0px;">请选择审核状态</label>
            <div class="col-md-2">
                <select name="search_reviewStatus" id="search_reviewStatus" class="form-control">
                    <option value="">--请选择--</option>
                    <option value="G002-0">未设计</option>
                    <option value="G002-1">已提交</option>
                    <option value="G002-2">已审核</option>
                </select>
            </div>
            <label class="control-label col-md-2" style="padding-right: 0px;">请输入登记时间</label>
            <div class="col-md-2">
                <input type="date" class="form-control" name="search_registerTime1" id="search_registerTime1"/>
            </div>
            <div class="col-md-2">
                <input type="date" class="form-control" name="search_registerTime2" id="search_registerTime2"/>
            </div>
            <div class="col-md-1 col-md-offset-1">
                <input type="button" id="process_search_btn" value="查询" class="btn btn-info">
            </div>
        </div>
    </form>
</div>

<!--生产工序设计单查询-->
<table id="process_design_inquiry_table"></table>


<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="/js/hAdmin.js?v=4.1.0"></script>
<script src="/js/currentTime.js"></script>

<!-- 第三方插件 -->
<script src="/js/plugins/pace/pace.min.js"></script>

<!--BootstrapTable-->
<script src="/bootstraptable/bootstrap-table.min.js"></script>
<script src="/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>

<script>
    $(function (){
        firstKind()
        secondKind()
        thirdKind()

        setTimeout(function (){
            let num=$("#process_design_inquiry_table").bootstrapTable("getOptions").totalRows
            $("#design_queries_total").html(num)
        },500)

        //工序设计单查询
        $("#process_design_inquiry_table").bootstrapTable({
            method: "post",
            contentType: "application/x-www-form-urlencoded",
            url:"/manufacture/process/processAllInquiry",
            // 数据行交替样式
            striped: true,
            // 是否是服务器端分页：server表示服务器端，client表示前端分页
            sidePagination: 'server',
            //初始化加载第一页
            pageNumber: 1,
            //是否分页
            pagination: true,
            // 单页记录数，页大小
            pageSize: 5,
            // 分页列表
            pageList: [8, 10, 20],
            // 请求参数
            queryParams: function (params) {
                let obj = {
                    // params.limit获取组件中的页大小
                    // params.offset获取请求数据的起始索引
                    pageSize: params.limit,
                    pageNo: (params.offset / params.limit) + 1,

                    // 查询表单的数据
                    search_firstKindId: $("#manufacture_process_search_form #search_firstKindId").val(),
                    search_secondKindId: $("#manufacture_process_search_form #search_secondKindId").val(),
                    search_thirdKindId: $("#manufacture_process_search_form #search_thirdKindId").val(),
                    search_reviewStatus: $("#manufacture_process_search_form #search_reviewStatus").val(),
                    search_registerTime1: $("#manufacture_process_search_form #search_registerTime1").val(),
                    search_registerTime2: $("#manufacture_process_search_form #search_registerTime2").val(),
                }
                return obj;
            },
            // 表格列标题
            columns: [{
                title: "设计单编号",
                field: "designId",
                formatter: function (value, row, index) {
                    let html = `<a href='javascript:getById(${row.id})'>${value}</a>`
                    return html
                }
            }, {
                title: "产品编号",
                field: "productId"
            }, {
                title: "产品名称",
                field: "productName"
            }, {
                title: "审核状态",
                field: "designModuleTag",
                formatter:function (value,row,index){
                    if(value=="G002-0"){
                        return "未完成";
                    }else if(value=="G002-1"){
                        return "等待";
                    }else {
                        return "完成";
                    }
                }
            }]
        })

        //点击查询按钮
        $("#manufacture_process_search_form #process_search_btn").click(function (){
            $("#process_design_inquiry_table").bootstrapTable("refresh")
        })

    })
    function firstKind(){
        $.post("/design/file/select",{"kid":"1"},function (res){
            $("#manufacture_process_search_form #search_firstKindId option:gt(0)").remove()
            for(let i=0;i<res.length;i++){
                let obj=res[i]
                let $op=$("<option>"+obj.kindName+"</option>")
                $op.val(obj.kindId)
                $("#manufacture_process_search_form #search_firstKindId").append($op)
            }
        })
    }
    function secondKind(){
        $.post("/design/file/select",{"kid":"2"},function (res){
            $("#manufacture_process_search_form #search_secondKindId option:gt(0)").remove()
            for(let i=0;i<res.length;i++){
                let obj=res[i]
                let $op=$("<option>"+obj.kindName+"</option>")
                $op.val(obj.kindId)
                $("#manufacture_process_search_form #search_secondKindId").append($op)
            }
        })
    }
    function thirdKind(){
        $.post("/design/file/select",{"kid":"3"},function (res){
            $("#manufacture_process_search_form #search_thirdKindId option:gt(0)").remove()
            for(let i=0;i<res.length;i++){
                let obj=res[i]
                let $op=$("<option>"+obj.kindName+"</option>")
                $op.val(obj.kindId)
                $("#manufacture_process_search_form #search_thirdKindId").append($op)
            }
        })
    }

    //点击设计单编号，查询详情
    function getById(id){
        //保存设计单id
        localStorage.setItem("id",id)
        window.location="manufacture_all_inquiries_operation_itemsByIdUI"
    }
</script>
</body>
</html>